package charpter11.lynx;

import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;

import net.mindview.util.TextFile;

public class TwentyOne {
	public static void main(String[] args) {
		Map<String, Integer> map = new HashMap<String, Integer>();
		if (args.length == 1){
			for (String string : new TextFile(args[0],"\\W")) {
				Integer integer = map.get(string);
				if (integer != null){
					map.put(string, integer + 1);
				}else{
					map.put(string, 1);
				}
			}			
		}else{
			System.out.println("没东西你让我统计什么啊");
		}
		
		LinkedList<String> entry = new LinkedList<String>(map.keySet());
		Collections.sort(entry);
		for (String string : entry) {
			System.out.println(string + ":" + map.get(string));
		}		
	}
}
